package com.xb.jdbc;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

public class MyJdbcDemo01 {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        //1.导入jar
        //2.加载驱动5.5数据库
        Class.forName("com.mysql.jdbc.Driver");
        //3.获取数据库连接
        Connection connection = DriverManager.getConnection("jdbc:mysql://localhost:3306/student?serverTimezone=UTC", "root","123456");
        //4.定义sql对象
        String sql = "update user set qq=50 where id=1";
        //5.获取执行对象
        Statement statement = connection.createStatement();
        //6.执行sql
        int count = statement.executeUpdate(sql);
        //7.处理结果
        System.out.println(count);
        //8.释放资源，先开的后关，后开的先关
        statement.close();
        connection.close();
    }
}
